using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Domain.Entidades;

namespace Data.Models.Mapping
{
    public class VW_menuMap : EntityTypeConfiguration<VW_menu>
    {
        public VW_menuMap()
        {
            // Primary Key
            this.HasKey(t => new { t.men_codigo, t.men_descricao,t.sub_codigo });

            // Properties
            this.Property(t => t.men_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.men_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.men_link)
                .HasMaxLength(50);

            this.Property(t => t.sub_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.sub_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.sub_link)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.sub_menu)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.men_image_caminho)
                .HasMaxLength(200);

            this.Property(t => t.sub_imagem_caminho)
             .HasMaxLength(100);

            this.Property(t => t.sub_target)
             .HasMaxLength(15);



            // Table & Column Mappings
            this.ToTable("VW_menu");
            this.Property(t => t.men_codigo).HasColumnName("men_codigo");
            this.Property(t => t.men_descricao).HasColumnName("men_descricao");
            this.Property(t => t.men_link).HasColumnName("men_link");
            this.Property(t => t.sub_codigo).HasColumnName("sub_codigo");
            this.Property(t => t.sub_descricao).HasColumnName("sub_descricao");
            this.Property(t => t.sub_link).HasColumnName("sub_link");
            this.Property(t => t.sub_menu).HasColumnName("sub_menu");
            this.Property(t => t.men_image_caminho).HasColumnName("men_image_caminho");
            this.Property(t => t.sub_imagem_caminho).HasColumnName("sub_imagem_caminho");
            this.Property(t => t.sub_target).HasColumnName("sub_target");
        }
    }
}
